package com.yuwei.module_vehicles.view

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.bumptech.glide.Glide
import com.bw.lib_base.path.RouterPath
import com.bw.lib_common.view.BaseMvvmActivity
import com.wildma.pictureselector.PictureBean
import com.wildma.pictureselector.PictureSelector
import com.yuwei.module_vehicles.R
import com.yuwei.module_vehicles.databinding.ActivityCarDistinguishBinding

/**
 * 智慧园区-02-停车缴费V1.1-车辆识别-20250507-崔志彪
 */
@Route(path = RouterPath.MODULE_CAR_DISTINGUISH_ACTIVITY)
class CarDistinguishActivity : BaseMvvmActivity<ActivityCarDistinguishBinding>() {
    override fun initView() {
        Glide.with(this).load(R.drawable.xj).into(binding.cameraIv)
        binding.backIv.setOnClickListener {
            finish()
        }
        //点击选择图片
        binding.vehicleBtn.setOnClickListener {
            PictureSelector.create(this, PictureSelector.SELECT_REQUEST_CODE).selectPicture()
        }
    }
    override fun observeDataChange() {

    }

    override fun getLayoutId(): Int = R.layout.activity_car_distinguish
    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (requestCode == PictureSelector.SELECT_REQUEST_CODE && resultCode == RESULT_OK) {
            val bundle = data?.extras
            val bean = bundle?.getParcelable<PictureBean>(PictureSelector.PICTURE_RESULT)
            val filePath = bean?.path
            Glide.with(this).load(filePath).into(binding.cameraIv)
        }
    }
}